<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('电影基本信息列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>是否删除(1为是，0为否)</label>
                                <input type="text" name="del"/>
                            </li>
                            <li>
                                <label>电影名：</label>
                                <input type="text" name="name"/>
                            </li>
                            <li>
                                <label>导演：</label>
                                <input type="text" name="director"/>
                            </li>
                            <li>
                                <label>主演：</label>
                                <input type="text" name="actor"/>
                            </li>
                            <li>
                                <label>上映年份：</label>
                                <input type="text" name="movieYear"/>
                            </li>
                            <li>
                                <label>上映区域：</label>
                                <input type="text" name="movieArea"/>
                            </li>
                            <li>
                                <label>语言：</label>
                                <input type="text" name="language"/>
                            </li>
                            <li>
                                <label>票价：</label>
                                <input type="text" name="price"/>
                            </li>
                            <li>
                                <label>状态(0即将上映，1上映中，2已下架）：</label>
                                <input type="text" name="state"/>
                            </li>
<!--                            <li>-->
<!--                                <label>操作者用户id：</label>-->
<!--                                <input type="text" name="operateId"/>-->
<!--                            </li>-->
<!--                            <li>-->
<!--                                <label>操作者用户名：</label>-->
<!--                                <input type="text" name="operateName"/>-->
<!--                            </li>-->
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:ticketmoviebaseinfo:add">
                    <i class="fa fa-plus"></i> 添加
                </a>
                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:ticketmoviebaseinfo:edit">
                    <i class="fa fa-edit"></i> 修改
                </a>
                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:ticketmoviebaseinfo:remove">
                    <i class="fa fa-remove"></i> 删除
                </a>
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:ticketmoviebaseinfo:export">
                    <i class="fa fa-download"></i> 导出
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('system:ticketmoviebaseinfo:edit')}]];
        var removeFlag = [[${@permission.hasPermi('system:ticketmoviebaseinfo:remove')}]];
        var prefix = ctx + "system/ticketmoviebaseinfo";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "电影基本信息",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'id',
                    title: '电影编号'//,
                    // visible: false
                },
                {
                    field: 'del',
                    title: '是否删除',//，1为是，0为否',
                    formatter: function(value, row, index) {
                        return (value == 1)? "是" : "否";
                    }
                },
                {
                    field: 'name',
                    title: '电影名'
                },
                {
                    field: 'director',
                    title: '导演'
                },
                {
                    field: 'actor',
                    title: '主演',
                    formatter: function(value, row, index) {
                        return limitText(value, 5);
                    }
                },
                {
                    field: 'movieType',
                    title: '电影类型名'
                },
                {
                    field: 'movieYear',
                    title: '电影上映年份'
                },
                {
                    field: 'movieArea',
                    title: '电影上映区域'
                },
                {
                    field: 'language',
                    title: '电影语言'
                },
                {
                    field: 'introduction',
                    title: '电影简介',
                    formatter: function(value, row, index) {
                        return limitText(value, 20);
                    }
                },
                // {
                //     field: 'image',
                //     title: '电影图片'
                // },
                {
                    field: 'price',
                    title: '票价'
                },
                {
                    field: 'state',
                    title: '状态',//(0即将上映，1上映中，2已下架）',
                    formatter: function(value, row, index) {
                        return (value == 0) ? "即将上映" :
                            (value == 1 ? "上映中" : "已下架");
                    }
                },
                // {
                //     field: 'operateId',
                //     title: '操作者用户id'
                // },
                {
                    field: 'operateName',
                    title: '操作者'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });


        //JS限制文本显示长度
        function limitText(str, length) {
            if (str.length > length) {
                return str.substring(0,length)+"...";
            }
            return str;
        }
    </script>
</body>
</html>